package com.example.rabbitmq.starter.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import lombok.RequiredArgsConstructor;

/**
 * RabbitMQ监听器配置
 */
@Configuration
@RequiredArgsConstructor
public class RabbitListenerConfig {

    private final Environment environment;

    /**
     * 创建企业队列名称Bean，用于@RabbitListener注解中使用
     */
    @Bean
    public String enterpriseQueueName() {
        return environment.getProperty("rabbitmq.business.enterprise.queue", "enterprise.update.queue");
    }
}